import numpy as np


def Distance(a):
    """
    计算两两城市之间的距离
    :param a: 各城市的位置坐标
    :return: 两两城市之间的距离
    """
    rows = len(a)  # 城市数量
    D = np.zeros((rows, rows))
    for i in range(0, rows):
        for j in range(i + 1, rows):
            D[i][j] = ((a[i][0] - a[j][0]) ** 2 + (a[i][1] - a[j][1]) ** 2) ** 0.5
            D[j][i] = D[i][j]
    return D